package com.creative.accountsdk.holder;

import com.creative.accountsdk.UmsChannel;
import com.creative.accountsdk.net.Protocol;
import com.creative.accountsdk.net.XParams;
import com.creative.util.EncodeUtil;
import com.loopj.android.http.RequestParams;

import org.json.JSONObject;

/**
 * Created by wang_qian on 2015/11/28.
 */
public class ParentCreateAndBindChildProtocol extends Protocol {

    private String username,password, nickname;

    public JSONObject jsonKids;

    public ParentCreateAndBindChildProtocol(String username, String password, String nickname)
    {
        this.username = username;
        this.password = password;
        this.nickname = nickname;
    }

    @Override
    public RequestParams getParams() {
        return new XParams().put("loginname", username)
                .put("pwd", EncodeUtil.encryptByBase64(password))
                .put(UmsChannel.PARAM_NAME, UmsChannel.getChannel())
                .put("nickname", nickname).getParams();
    }

    @Override
    public String getUrl() {
        return getUrlPrefix()+"ui/bind/nkid";
    }

    @Override
    protected void parseReturnMap(JSONObject returnMap) {
        jsonKids = returnMap;
    }
}
